package com.example.reference_book.filter.schoolImpl;

import com.example.reference_book.entity.School;
import com.example.reference_book.filter.SchoolFilter;

import java.util.ArrayList;
import java.util.List;

public class SchoolNameFilter implements SchoolFilter {
    @Override
    public List<School> getList(String key, List<School> list) {
        List<School> res = new ArrayList<>();
        for (School item : list) {
            if (item.getName().contains(key)) {
                res.add(item);
            }
        }
        return res;
    }
}
